<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>症状信息</title>
      <link rel="stylesheet" type="text/css" href="../xhAdmin/css/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../xhAdmin/css/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../xhAdmin/css/themes/color.css">
    <link rel="stylesheet" type="text/css" href="../xhAdmin/css/demo/demo.css">
    <script type="text/javascript" src="../xhAdmin/js/jquery.min.js"></script>
    <script type="text/javascript" src="../xhAdmin/js/jquery.easyui.min.js"></script>
</head>

<body>
    <div id="toolbar-symptom">
        <a href="javascript:void(0)" id="symptomAddBtn" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="symptomAdd()">添加</a>
        <a href="javascript:void(0)" id="symptomEditBtn" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="symptomEdit()">修改</a>
        <a href="javascript:void(0)" id="symptomDestroyBtn" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="symptomDestroy()">删除</a>
    </div>
    <table id="symptom-table" class="easyui-datagrid" data-options="fit:true,border:false,url:'../xhSymptom/all',method:'get'" style="width:auto;height:100%" toolbar="#toolbar-symptom" pagination="true" rownumbers="true" fitColumns="true" singleSelect="true" pageSize="20">
        <thead>
            <tr>
               <th field="level" width="16%" align="center">病症类别</th>
               <th field="name" width="17%" align="center">病症名称</th>
                <th field="introduction" width="17%" align="center">病症说明</th>
                <th field="style" width="17%" align="center">病症类型</th>
                <th field="perform" width="17%" align="center">临床表现</th>
                <th field="reason" width="17%" align="center">致病原因</th>
                <th field="life" width="17%" align="center">生活注意</th>
                <th field="diet" width="17%" align="center">饮食注意</th>
                <th field="better" width="17%" align="center">宜食食物及功效</th>
                <th field="worse" width="17%" align="center">慎食食物及原因</th>
                <th field="foodname" width="17%" align="center">推荐食谱</th>
                <th field="material" width="17%" align="center">食谱材料</th>
                <th field="seasoning" width="17%" align="center">食谱调料</th>
                <th field="method" width="17%" align="center">做法</th>
                <th field="effect" width="17%" align="center">功效</th>
            </tr>
        </thead>
    </table>
    <div id="dlg-symptomAdd" class="easyui-dialog" style="width:650px;height:393px;padding:1px 1px" closed="true" buttons="#dlg-symptomAdd-btn" align="center" data-options="modal:true">
        <form id="fm-symptomAdd" method="post" novalidate>
            <table class="pattern" border="0" cellpadding="5" cellspacing="0">
              <tr>
				<th width="100px">病症类别：</th>
				<td colspan="3"><input type="text" id="level" name="level" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">病症名称：</th>
				<td colspan="3"><input type="text" id="name" name="name" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">病症说明：</th>
				<td colspan="3"><input type="text" id="introduction" name="introduction" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				<th width="100px">病症类型：</th>
				<td colspan="3"><input type="text" id="style" name="style" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">临床表现：</th>
				<td colspan="3"><input type="text" id="perform" name="perform" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">致病原因：</th>
				<td colspan="3"><input type="text" id="reason" name="reason" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				<th width="100px">生活注意：</th>
				<td colspan="3"><input type="text" id="life" name="life" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">饮食注意：</th>
				<td colspan="3"><input type="text" id="diet" name="diet" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">宜食食物及功效：</th>
				<td colspan="3"><input type="text" id="better" name="better" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				<th width="100px">慎食食物及原因：</th>
				<td colspan="3"><input type="text" id="worse" name="worse" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">推荐食谱：</th>
				<td colspan="3"><input type="text" id="foodname" name="foodname" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">食谱材料：</th>
				<td colspan="3"><input type="text" id="material" name="material" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				
				<th width="100px">食谱调料：</th>
				<td colspan="3"><input type="text" id="seasoning" name="seasoning" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">做法：</th>
				<td colspan="3"><input type="text" id="method" name="method" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">功效：</th>
				<td colspan="3"><input type="text" id="effect" name="effect" class="easyui-textbox" style="width:100%"></td>
			</tr>
			
            </table>
        </form>
    </div>
    <div id="dlg-symptomAdd-btn">
        <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="symptomAddSave()" style="width:90px">保存</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg-symptomAdd').dialog('close')" style="width:90px">关闭</a>
    </div>
    <div id="dlg-symptomEdit" class="easyui-dialog" style="width:650px;height:393px;padding:1px 1px" closed="true" buttons="#dlg-symptomEdit-btn" align="center" data-options="modal:true">
        <form id="fm-symptomEdit" method="post" novalidate>
            <table class="pattern" border="0">
			  <tr>
				<th width="100px">病症类别：</th>
				<td colspan="3"><input type="text" id="level" name="level" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">病症名称：</th>
				<td colspan="3"><input type="text" id="name" name="name" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">病症说明：</th>
				<td colspan="3"><input type="text" id="introduction" name="introduction" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				<th width="100px">病症类型：</th>
				<td colspan="3"><input type="text" id="style" name="style" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">临床表现：</th>
				<td colspan="3"><input type="text" id="perform" name="perform" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">致病原因：</th>
				<td colspan="3"><input type="text" id="reason" name="reason" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				<th width="100px">生活注意：</th>
				<td colspan="3"><input type="text" id="life" name="life" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">饮食注意：</th>
				<td colspan="3"><input type="text" id="diet" name="diet" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">宜食食物及功效：</th>
				<td colspan="3"><input type="text" id="better" name="better" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				<th width="100px">慎食食物及原因：</th>
				<td colspan="3"><input type="text" id="worse" name="worse" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">推荐食谱：</th>
				<td colspan="3"><input type="text" id="foodname" name="foodname" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">食谱材料：</th>
				<td colspan="3"><input type="text" id="material" name="material" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				
				<th width="100px">食谱调料：</th>
				<td colspan="3"><input type="text" id="seasoning" name="seasoning" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">做法：</th>
				<td colspan="3"><input type="text" id="method" name="method" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">功效：</th>
				<td colspan="3"><input type="text" id="effect" name="effect" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <input type="hidden" name="id" />
			</table>
        </form>
    </div>
    <div id="dlg-symptomEdit-btn">
        <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="symptomEditSave()" style="width:90px">保存</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg-symptomEdit').dialog('close')" style="width:90px">关闭</a>
    </div>
    <div id="dlg-symptomReadonly" class="easyui-dialog" style="width:650px;height:393px;padding:1px 1px" closed="true" buttons="#dlg-symptomReadonly-btn" align="center" data-options="modal:true">
        <form id="fm-symptomReadonly" method="post" novalidate>
            <table class="pattern" border="0" cellpadding="5" cellspacing="0">
			 <tr>
				<th width="100px">病症类别：</th>
				<td colspan="3"><input type="text" id="level" name="level" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">病症名称：</th>
				<td colspan="3"><input type="text" id="name" name="name" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">病症说明：</th>
				<td colspan="3"><input type="text" id="introduction" name="introduction" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				<th width="100px">病症类型：</th>
				<td colspan="3"><input type="text" id="style" name="style" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">临床表现：</th>
				<td colspan="3"><input type="text" id="perform" name="perform" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">致病原因：</th>
				<td colspan="3"><input type="text" id="reason" name="reason" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				<th width="100px">生活注意：</th>
				<td colspan="3"><input type="text" id="life" name="life" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">饮食注意：</th>
				<td colspan="3"><input type="text" id="diet" name="diet" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">宜食食物及功效：</th>
				<td colspan="3"><input type="text" id="better" name="better" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				<th width="100px">慎食食物及原因：</th>
				<td colspan="3"><input type="text" id="worse" name="worse" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">推荐食谱：</th>
				<td colspan="3"><input type="text" id="foodname" name="foodname" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">食谱材料：</th>
				<td colspan="3"><input type="text" id="material" name="material" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <tr>
				
				<th width="100px">食谱调料：</th>
				<td colspan="3"><input type="text" id="seasoning" name="seasoning" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">做法：</th>
				<td colspan="3"><input type="text" id="method" name="method" class="easyui-textbox" style="width:100%"></td>
				<th width="100px">功效：</th>
				<td colspan="3"><input type="text" id="effect" name="effect" class="easyui-textbox" style="width:100%"></td>
			</tr>
			 <input type="hidden" name="id" />
			</table>
        </form>
    </div>
    <div id="dlg-symptomReadonly-btn">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg-symptomReadonly').dialog('close')" style="width:90px">关闭</a>
    </div>
    <script type="text/javascript">
    $(document).ready(function() {
      

        $("#symptom-table").datagrid({
            //双击事件  
            onDblClickRow: function(index, row) {
                if (row) {
                    $('#dlg-symptomReadonly').dialog('open').dialog('center').dialog('setTitle', '查看病症信息');
                    $('#fm-symptomReadonly').form('load', row);
                }
            }
        });

    });

    function symptomAdd() {
        $('#dlg-symptomAdd').dialog('open').dialog('center').dialog('setTitle', '添加病症信息');
        $('#fm-symptomAdd').form('clear');
    }

    function symptomAddSave() {
        $('#fm-symptomAdd').form('submit', {
            url: '../xhSymptom/add',
            onSubmit: function() {
                //进行表单验证
                //如果返回false阻止提交
                return $(this).form('enableValidation').form('validate');
            },
            success: function(data) {
                var data = eval('(' + data + ')'); // change the JSON string to javascript object
                if (data.result == 'success') {
                    $('#dlg-symptomAdd').dialog('close');
                    $('#symptom-table').datagrid('reload');
                    $.messager.show({ // show error message
                        title: '操作完成',
                        msg: data.description
                    });
                } else {
                    $.messager.show({ // show error message
                        title: '出错了',
                        msg: data.description
                    });
                }
            }
        });

    }

    function symptomEdit() {
        var row = $('#symptom-table').datagrid('getSelected');
        if (row) {
            $('#dlg-symptomEdit').dialog('open').dialog('center').dialog('setTitle', '修改病症信息');
            $('#fm-symptomEdit').form('load', row);
        }
    }

    function symptomEditSave() {
        $('#fm-symptomEdit').form('submit', {
            url: '../xhSymptom/update',
            onSubmit: function() {
                //进行表单验证
                //如果返回false阻止提交
                return $(this).form('enableValidation').form('validate');
            },
            success: function(data) {
                var data = eval('(' + data + ')'); // change the JSON string to javascript object
                if (data.result == 'success') {
                    $('#dlg-symptomEdit').dialog('close');
                    $('#symptom-table').datagrid('reload');
                    $.messager.show({ // show error message
                        title: '操作完成',
                        msg: data.description
                    });
                } else {
                    $.messager.show({ // show error message
                        title: '出错了',
                        msg: data.description
                    });
                }
            }
        });
    }

    function symptomDestroy() {
        var row = $('#symptom-table').datagrid('getSelected');
        if (row) {
            $.messager.confirm('删除', '是否彻底删除该病症信息？？？', function(r) {
                if (r) {
                    $.post('../xhSymptom/delete', {
                        id: row.id
                    }, function(data) {
                        if (data.result == 'success') {
                            $('#symptom-table').datagrid('reload'); // reload the user data
                            $.messager.show({ // show error message
                                title: '操作完成',
                                msg: data.description
                            });
                        } else {
                            $.messager.show({ // show error message
                                title: '出错了',
                                msg: data.description
                            });
                        }
                    }, 'json');
                }
            });
        }
    }
    </script>
</body>

</html>
